package demo.practice.leetcode;

public class P26 {

    public static void main(String[] args) {
        int[]t= {1,1,2};

        P26 p26= new P26();
        p26.removeDuplicates(t);
    }

    public int removeDuplicates(int[] nums) {

        int length=nums.length;

        for(int i=1;i<length;i++){
            if(nums[i]==nums[i-1]){
                for(int j=i;j<length-1;j++){
                    nums[j]=nums[j+1];
                }
                length--;
            }
        }

        return length;
    }
}
